Fix Visual Studio Build Since a080cb4
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 23 Sep 2015 15:24:36 +0000 (23:24 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 23 Sep 2015 15:24:36 +0000 (23:24 +0800)
The patch did not check for Visual Studio 2008 correctly, plus it
would break the build on later Visual Studio versions, as it should
be __popcnt(), not __popcount().  Fix that.

gtk/gtkcssselector.c

index f252bbc7b6c1f9a671dc3cc315b3673c71e93ad6..e987aa1292248289577fbc244086c9f29c8026a2 100644 (file)
@@ -25,9 +25,8 @@
 #include "gtkcssprovider.h"
 #include "gtkstylecontextprivate.h"
 
-#if defined(_MSC_VER) && _MSC_VER > 1500
+#if defined(_MSC_VER) && _MSC_VER >= 1500
 # include <intrin.h>
-# define __builtin_popcount(n) __popcount(n)
 #endif
 
 typedef struct _GtkCssSelectorClass GtkCssSelectorClass;
@@ -758,8 +757,8 @@ count_bits (guint n)
   return (guint) __builtin_popcount (n);
 #elif defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1))
   return (guint) __builtin_popcount (n);
-#elif defined(_MSC_VER) && _MSC_VER > 1500
-  return (guint) __builtin_popcount (n);
+#elif defined(_MSC_VER) && _MSC_VER >= 1500
+  return (guint) __popcnt (n);
 #else
   guint result = 0;